$(document).ready(function () { // set dimensions for each image $('img').each(function () { var MyWidth = 0; var MyHeight = 0; var MyRatio = 0; var MyImgSize = $(this).attr('data-size'); if (typeof MyImgSize !== 'undefined' && MyImgSize !== '' && MyImgSize !== '0x0') { var MyValues = MyImgSize.split('x'); MyWidth = MyValues[0]; MyHeight = MyValues[1]; } else { MyWidth = $(this).width(); MyHeight = $(this).height(); } if (MyWidth > MyHeight) { MyRatio = MyWidth / MyHeight; } else { MyRatio = MyHeight / MyWidth; } //var MyWidth = $(this).width(); //var MyHeight = $(this).height(); //var MyRatio = MyWidth / MyHeight; //var MyNewHeight = $(this).parents("div").height(); //var MyNewWidth = MyNewHeight * MyRatio; var MyNewWidth = $(this).parents("div").width(); var MyNewHeight = parseFloat(MyNewWidth / MyRatio).toFixed(1); $(this).not('.FixedSize').attr('width', MyNewWidth); $(this).not('.FixedSize').attr('height', MyNewHeight); }) $("img.navbar-brand-logo").attr('width', '72.75'); $("img.navbar-brand-logo").attr('height', '30'); $("img.ColorChoice").attr('width', '24'); $("img.ColorChoice").attr('height', '24'); $("img.FDPChoice").attr('width', 'auto'); $("img.FDPChoice").attr('height', '24'); // run lazyload function lazyload(); });